\(\int (c+d x) \cot (a+b x) \csc (a+b x) \, dx\) [42]

   Optimal result
   Rubi [A] (verified)
   Mathematica [B] (verified)
   Maple [A] (verified)
   Fricas [B] (verification not implemented)
   Sympy [F]
   Maxima [B] (verification not implemented)
   Giac [B] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 18, antiderivative size = 30 \[ \int (c+d x) \cot (a+b x) \csc (a+b x) \, dx=-\frac {d \text {arctanh}(\cos (a+b x))}{b^2}-\frac {(c+d x) \csc (a+b x)}{b} \]

[Out]

-d*arctanh(cos(b*x+a))/b^2-(d*x+c)*csc(b*x+a)/b

Rubi [A] (verified)

Time = 0.02 (sec) , antiderivative size = 30, normalized size of antiderivative = 1.00, number of steps used = 2, number of rules used = 2, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.111, Rules used = {4495, 3855} \[ \int (c+d x) \cot (a+b x) \csc (a+b x) \, dx=-\frac {d \text {arctanh}(\cos (a+b x))}{b^2}-\frac {(c+d x) \csc (a+b x)}{b} \]

[In]

Int[(c + d*x)*Cot[a + b*x]*Csc[a + b*x],x]

[Out]

-((d*ArcTanh[Cos[a + b*x]])/b^2) - ((c + d*x)*Csc[a + b*x])/b

Rule 3855

Int[csc[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-ArcTanh[Cos[c + d*x]]/d, x] /; FreeQ[{c, d}, x]

Rule 4495

Int[Cot[(a_.) + (b_.)*(x_)]^(p_.)*Csc[(a_.) + (b_.)*(x_)]^(n_.)*((c_.) + (d_.)*(x_))^(m_.), x_Symbol] :> Simp[
(-(c + d*x)^m)*(Csc[a + b*x]^n/(b*n)), x] + Dist[d*(m/(b*n)), Int[(c + d*x)^(m - 1)*Csc[a + b*x]^n, x], x] /;
FreeQ[{a, b, c, d, n}, x] && EqQ[p, 1] && GtQ[m, 0]

Rubi steps \begin{align*} \text {integral}& = -\frac {(c+d x) \csc (a+b x)}{b}+\frac {d \int \csc (a+b x) \, dx}{b} \\ & = -\frac {d \text {arctanh}(\cos (a+b x))}{b^2}-\frac {(c+d x) \csc (a+b x)}{b} \\ \end{align*}

Mathematica [B] (verified)

Leaf count is larger than twice the leaf count of optimal. \(131\) vs. \(2(30)=60\).

Time = 0.11 (sec) , antiderivative size = 131, normalized size of antiderivative = 4.37 \[ \int (c+d x) \cot (a+b x) \csc (a+b x) \, dx=-\frac {d x \csc (a)}{b}-\frac {c \csc (a+b x)}{b}-\frac {d \log \left (\cos \left (\frac {a}{2}+\frac {b x}{2}\right )\right )}{b^2}+\frac {d \log \left (\sin \left (\frac {a}{2}+\frac {b x}{2}\right )\right )}{b^2}+\frac {d x \csc \left (\frac {a}{2}\right ) \csc \left (\frac {a}{2}+\frac {b x}{2}\right ) \sin \left (\frac {b x}{2}\right )}{2 b}-\frac {d x \sec \left (\frac {a}{2}\right ) \sec \left (\frac {a}{2}+\frac {b x}{2}\right ) \sin \left (\frac {b x}{2}\right )}{2 b} \]

[In]

Integrate[(c + d*x)*Cot[a + b*x]*Csc[a + b*x],x]

[Out]

-((d*x*Csc[a])/b) - (c*Csc[a + b*x])/b - (d*Log[Cos[a/2 + (b*x)/2]])/b^2 + (d*Log[Sin[a/2 + (b*x)/2]])/b^2 + (
d*x*Csc[a/2]*Csc[a/2 + (b*x)/2]*Sin[(b*x)/2])/(2*b) - (d*x*Sec[a/2]*Sec[a/2 + (b*x)/2]*Sin[(b*x)/2])/(2*b)

Maple [A] (verified)

Time = 0.51 (sec) , antiderivative size = 46, normalized size of antiderivative = 1.53

method result size
parallelrisch \(\frac {2 \ln \left (\tan \left (\frac {a}{2}+\frac {x b}{2}\right )\right ) d -\sec \left (\frac {a}{2}+\frac {x b}{2}\right ) \csc \left (\frac {a}{2}+\frac {x b}{2}\right ) b \left (d x +c \right )}{2 b^{2}}\) \(46\)
derivativedivides \(\frac {\frac {d a}{b \sin \left (x b +a \right )}-\frac {c}{\sin \left (x b +a \right )}+\frac {d \left (-\frac {x b +a}{\sin \left (x b +a \right )}+\ln \left (\csc \left (x b +a \right )-\cot \left (x b +a \right )\right )\right )}{b}}{b}\) \(68\)
default \(\frac {\frac {d a}{b \sin \left (x b +a \right )}-\frac {c}{\sin \left (x b +a \right )}+\frac {d \left (-\frac {x b +a}{\sin \left (x b +a \right )}+\ln \left (\csc \left (x b +a \right )-\cot \left (x b +a \right )\right )\right )}{b}}{b}\) \(68\)
risch \(-\frac {2 i \left (d x +c \right ) {\mathrm e}^{i \left (x b +a \right )}}{b \left ({\mathrm e}^{2 i \left (x b +a \right )}-1\right )}+\frac {d \ln \left ({\mathrm e}^{i \left (x b +a \right )}-1\right )}{b^{2}}-\frac {d \ln \left ({\mathrm e}^{i \left (x b +a \right )}+1\right )}{b^{2}}\) \(70\)
norman \(\frac {-\frac {c}{2 b}-\frac {c \tan \left (\frac {a}{2}+\frac {x b}{2}\right )^{2}}{2 b}-\frac {d x}{2 b}-\frac {d x \tan \left (\frac {a}{2}+\frac {x b}{2}\right )^{2}}{2 b}}{\tan \left (\frac {a}{2}+\frac {x b}{2}\right )}+\frac {d \ln \left (\tan \left (\frac {a}{2}+\frac {x b}{2}\right )\right )}{b^{2}}\) \(78\)

[In]

int((d*x+c)*cos(b*x+a)*csc(b*x+a)^2,x,method=_RETURNVERBOSE)

[Out]

1/2*(2*ln(tan(1/2*a+1/2*x*b))*d-sec(1/2*a+1/2*x*b)*csc(1/2*a+1/2*x*b)*b*(d*x+c))/b^2

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 62 vs. \(2 (30) = 60\).

Time = 0.27 (sec) , antiderivative size = 62, normalized size of antiderivative = 2.07 \[ \int (c+d x) \cot (a+b x) \csc (a+b x) \, dx=-\frac {2 \, b d x + d \log \left (\frac {1}{2} \, \cos \left (b x + a\right ) + \frac {1}{2}\right ) \sin \left (b x + a\right ) - d \log \left (-\frac {1}{2} \, \cos \left (b x + a\right ) + \frac {1}{2}\right ) \sin \left (b x + a\right ) + 2 \, b c}{2 \, b^{2} \sin \left (b x + a\right )} \]

[In]

integrate((d*x+c)*cos(b*x+a)*csc(b*x+a)^2,x, algorithm="fricas")

[Out]

-1/2*(2*b*d*x + d*log(1/2*cos(b*x + a) + 1/2)*sin(b*x + a) - d*log(-1/2*cos(b*x + a) + 1/2)*sin(b*x + a) + 2*b
*c)/(b^2*sin(b*x + a))

Sympy [F]

\[ \int (c+d x) \cot (a+b x) \csc (a+b x) \, dx=\int \left (c + d x\right ) \cos {\left (a + b x \right )} \csc ^{2}{\left (a + b x \right )}\, dx \]

[In]

integrate((d*x+c)*cos(b*x+a)*csc(b*x+a)**2,x)

[Out]

Integral((c + d*x)*cos(a + b*x)*csc(a + b*x)**2, x)

Maxima [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 259 vs. \(2 (30) = 60\).

Time = 0.23 (sec) , antiderivative size = 259, normalized size of antiderivative = 8.63 \[ \int (c+d x) \cot (a+b x) \csc (a+b x) \, dx=-\frac {\frac {{\left (4 \, {\left (b x + a\right )} \cos \left (b x + a\right ) \sin \left (2 \, b x + 2 \, a\right ) - 4 \, {\left (b x + a\right )} \cos \left (2 \, b x + 2 \, a\right ) \sin \left (b x + a\right ) + {\left (\cos \left (2 \, b x + 2 \, a\right )^{2} + \sin \left (2 \, b x + 2 \, a\right )^{2} - 2 \, \cos \left (2 \, b x + 2 \, a\right ) + 1\right )} \log \left (\cos \left (b x + a\right )^{2} + \sin \left (b x + a\right )^{2} + 2 \, \cos \left (b x + a\right ) + 1\right ) - {\left (\cos \left (2 \, b x + 2 \, a\right )^{2} + \sin \left (2 \, b x + 2 \, a\right )^{2} - 2 \, \cos \left (2 \, b x + 2 \, a\right ) + 1\right )} \log \left (\cos \left (b x + a\right )^{2} + \sin \left (b x + a\right )^{2} - 2 \, \cos \left (b x + a\right ) + 1\right ) + 4 \, {\left (b x + a\right )} \sin \left (b x + a\right )\right )} d}{{\left (\cos \left (2 \, b x + 2 \, a\right )^{2} + \sin \left (2 \, b x + 2 \, a\right )^{2} - 2 \, \cos \left (2 \, b x + 2 \, a\right ) + 1\right )} b} + \frac {2 \, c}{\sin \left (b x + a\right )} - \frac {2 \, a d}{b \sin \left (b x + a\right )}}{2 \, b} \]

[In]

integrate((d*x+c)*cos(b*x+a)*csc(b*x+a)^2,x, algorithm="maxima")

[Out]

-1/2*((4*(b*x + a)*cos(b*x + a)*sin(2*b*x + 2*a) - 4*(b*x + a)*cos(2*b*x + 2*a)*sin(b*x + a) + (cos(2*b*x + 2*
a)^2 + sin(2*b*x + 2*a)^2 - 2*cos(2*b*x + 2*a) + 1)*log(cos(b*x + a)^2 + sin(b*x + a)^2 + 2*cos(b*x + a) + 1)
- (cos(2*b*x + 2*a)^2 + sin(2*b*x + 2*a)^2 - 2*cos(2*b*x + 2*a) + 1)*log(cos(b*x + a)^2 + sin(b*x + a)^2 - 2*c
os(b*x + a) + 1) + 4*(b*x + a)*sin(b*x + a))*d/((cos(2*b*x + 2*a)^2 + sin(2*b*x + 2*a)^2 - 2*cos(2*b*x + 2*a)
+ 1)*b) + 2*c/sin(b*x + a) - 2*a*d/(b*sin(b*x + a)))/b

Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 697 vs. \(2 (30) = 60\).

Time = 0.54 (sec) , antiderivative size = 697, normalized size of antiderivative = 23.23 \[ \int (c+d x) \cot (a+b x) \csc (a+b x) \, dx=\text {Too large to display} \]

[In]

integrate((d*x+c)*cos(b*x+a)*csc(b*x+a)^2,x, algorithm="giac")

[Out]

1/2*(b*d*x*tan(1/2*b*x)^2*tan(1/2*a)^2 + b*c*tan(1/2*b*x)^2*tan(1/2*a)^2 + b*d*x*tan(1/2*b*x)^2 - d*log(4*(tan
(1/2*b*x)^2*tan(1/2*a)^2 - 2*tan(1/2*b*x)*tan(1/2*a) + 1)/(tan(1/2*b*x)^2*tan(1/2*a)^2 + tan(1/2*b*x)^2 + tan(
1/2*a)^2 + 1))*tan(1/2*b*x)^2*tan(1/2*a) + d*log(4*(tan(1/2*b*x)^2 + 2*tan(1/2*b*x)*tan(1/2*a) + tan(1/2*a)^2)
/(tan(1/2*b*x)^2*tan(1/2*a)^2 + tan(1/2*b*x)^2 + tan(1/2*a)^2 + 1))*tan(1/2*b*x)^2*tan(1/2*a) + b*d*x*tan(1/2*
a)^2 - d*log(4*(tan(1/2*b*x)^2*tan(1/2*a)^2 - 2*tan(1/2*b*x)*tan(1/2*a) + 1)/(tan(1/2*b*x)^2*tan(1/2*a)^2 + ta
n(1/2*b*x)^2 + tan(1/2*a)^2 + 1))*tan(1/2*b*x)*tan(1/2*a)^2 + d*log(4*(tan(1/2*b*x)^2 + 2*tan(1/2*b*x)*tan(1/2
*a) + tan(1/2*a)^2)/(tan(1/2*b*x)^2*tan(1/2*a)^2 + tan(1/2*b*x)^2 + tan(1/2*a)^2 + 1))*tan(1/2*b*x)*tan(1/2*a)
^2 + b*c*tan(1/2*b*x)^2 + b*c*tan(1/2*a)^2 + b*d*x + d*log(4*(tan(1/2*b*x)^2*tan(1/2*a)^2 - 2*tan(1/2*b*x)*tan
(1/2*a) + 1)/(tan(1/2*b*x)^2*tan(1/2*a)^2 + tan(1/2*b*x)^2 + tan(1/2*a)^2 + 1))*tan(1/2*b*x) - d*log(4*(tan(1/
2*b*x)^2 + 2*tan(1/2*b*x)*tan(1/2*a) + tan(1/2*a)^2)/(tan(1/2*b*x)^2*tan(1/2*a)^2 + tan(1/2*b*x)^2 + tan(1/2*a
)^2 + 1))*tan(1/2*b*x) + d*log(4*(tan(1/2*b*x)^2*tan(1/2*a)^2 - 2*tan(1/2*b*x)*tan(1/2*a) + 1)/(tan(1/2*b*x)^2
*tan(1/2*a)^2 + tan(1/2*b*x)^2 + tan(1/2*a)^2 + 1))*tan(1/2*a) - d*log(4*(tan(1/2*b*x)^2 + 2*tan(1/2*b*x)*tan(
1/2*a) + tan(1/2*a)^2)/(tan(1/2*b*x)^2*tan(1/2*a)^2 + tan(1/2*b*x)^2 + tan(1/2*a)^2 + 1))*tan(1/2*a) + b*c)/(b
^2*tan(1/2*b*x)^2*tan(1/2*a) + b^2*tan(1/2*b*x)*tan(1/2*a)^2 - b^2*tan(1/2*b*x) - b^2*tan(1/2*a))

Mupad [B] (verification not implemented)

Time = 24.28 (sec) , antiderivative size = 88, normalized size of antiderivative = 2.93 \[ \int (c+d x) \cot (a+b x) \csc (a+b x) \, dx=-\frac {d\,\ln \left ({\mathrm {e}}^{a\,1{}\mathrm {i}+b\,x\,1{}\mathrm {i}}\,1{}\mathrm {i}+1{}\mathrm {i}\right )}{b^2}+\frac {d\,\ln \left (d\,2{}\mathrm {i}-d\,{\mathrm {e}}^{a\,1{}\mathrm {i}}\,{\mathrm {e}}^{b\,x\,1{}\mathrm {i}}\,2{}\mathrm {i}\right )}{b^2}-\frac {{\mathrm {e}}^{a\,1{}\mathrm {i}+b\,x\,1{}\mathrm {i}}\,\left (c+d\,x\right )\,2{}\mathrm {i}}{b\,\left ({\mathrm {e}}^{a\,2{}\mathrm {i}+b\,x\,2{}\mathrm {i}}-1\right )} \]

[In]

int((cos(a + b*x)*(c + d*x))/sin(a + b*x)^2,x)

[Out]

(d*log(d*2i - d*exp(a*1i)*exp(b*x*1i)*2i))/b^2 - (d*log(exp(a*1i + b*x*1i)*1i + 1i))/b^2 - (exp(a*1i + b*x*1i)
*(c + d*x)*2i)/(b*(exp(a*2i + b*x*2i) - 1))